# Contributor: knuxify <knuxify@gmail.com>
# Maintainer: knuxify <knuxify@gmail.com>
pkgname=py3-networkmanager
pkgver=2.2
pkgrel=0
pkgdesc="Easy communication with NetworkManager"
url="https://github.com/seveas/python-networkmanager"
arch="noarch"
license="Zlib"
depends="py3-dbus py3-six"
makedepends="python3 py3-setuptools"
checkdepends="dbus networkmanager"
source="https://github.com/seveas/python-networkmanager/archive/refs/tags/$pkgver/python-networkmanager-$pkgver.tar.gz
	allow-no-mainloop.patch
	handle-routing-rules.patch
	fix-nm-1-34-compatibility.patch"
builddir="$srcdir/python-networkmanager-$pkgver"
# test suite is fairly invasive and seems to fail, upstream CI doesn't use it
options="!check"

build() {
	python3 setup.py build
}

check() {
	export NM_TESTS=1
	PYTHONPATH="$builddir" python3 -m unittest discover
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
44a33aee5962a2d2a9a13aacb02e684020b3b7d3a6174ace2d29dde4106cd852dca1421493a64af6884ce240080d9984feae009d183439cf2f11b1710e11dc3a  python-networkmanager-2.2.tar.gz
f8b30d8705e7ce4034b4dab81f8f9cd23f86275a14f799124dc2399c2abbe5510c372cbc32294497bd965b819df4e2e72775597e22f7a6c56a5aacece2611536  allow-no-mainloop.patch
6b3b06dde26069ae4b9f5ca240cf4e138df4e67556527621492658156d182635ef97fdee4fc67a6de8670e56a443155d6130be23485a70e390ff4cc7cc49e787  handle-routing-rules.patch
5e68233f09048df735e7131486604c243eb1ad86d4e90b3b20bfb483d9af8a497a40ba81653e430a2da9aaf917104cf017788a82e2d444eb66fc0701b7a9c47b  fix-nm-1-34-compatibility.patch
"
